from django.db import models


class StarPaper(models.Model):
    user_id = models.ForeignKey('accounts_sys.User', on_delete=models.CASCADE)
    paper_id = models.CharField(max_length=15)
    star_time = models.DateTimeField(auto_now_add=True)

    def parse_dict(self):
        return {
            "user_id": self.user_id,
            "paper_id": self.paper_id,
            "star_time": self.star_time
        }


class StarScholar(models.Model):
    user_id = models.ForeignKey('accounts_sys.User', on_delete=models.CASCADE)
    scholar_id = models.CharField(max_length=15)
    star_time = models.DateTimeField(auto_now_add=True)

    def parse_dict(self):
        return {
            "user_id": self.user_id,
            "scholar_id": self.scholar_id,
            "star_time": self.star_time
        }
